﻿@model RotaractProjectCalendar.ViewModels.ProjectIndexData

@{
    ViewBag.Title = "Moje projekty";
}

<h2>Moje projekty</h2>

<p>
    @Html.ActionLink("Dodaj projekt", "Create")
</p>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Projects.FirstOrDefault().StartDateTime)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Projects.FirstOrDefault().EndDateTime)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Projects.FirstOrDefault().ProjectTitle)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Projects.FirstOrDefault().Club.ClubTitle)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Projects.FirstOrDefault().Location)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Projects.FirstOrDefault().City.CityName)
        </th>
        <th></th>
    </tr>

    @foreach(var item in Model.Projects)
    {
        var selectedRow = "";
        if(item.Id == ViewBag.InstructorID)
        {
            selectedRow = "success";
        }
        <tr class="@selectedRow">
            <td>
                @Html.DisplayFor(modelItem => item.StartDateTime)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.EndDateTime)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ProjectTitle)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Club.ClubTitle)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Location)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.City.CityName)
            </td>
            @Html.HiddenFor(model => model.Coordinator)
            <td>
                @Html.ActionLink("Szczegóły", "Details", new { id = item.Id }) |
                @Html.ActionLink("Edycja", "Edit", new { id = item.Id }) |
                @Html.ActionLink("Usuń", "Delete", new { id = item.Id })
            </td>
        </tr>
    }
</table>